package com.easyaop.commons.utils;

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;

public class IOUtils {
    public static byte[] from(Class clz){
        try {
            String name = clz.getName().replaceAll("\\.","/") + ".class";
//            URL resource1 = clz.getResource(name);
            InputStream resource = clz.getClassLoader().getResourceAsStream(name);

            byte[] bytes = new byte[resource.available()];
            resource.read(bytes);
            return bytes;
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

}
